<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home></home>
  </div>
  <script src="./vue.js"></script>
  <script>
    const CommonTitle = {
      template: `
        <div>
          <h3>这是子组件</h3>  
        </div>
      `,
      // 子组件获取父组件 provide提供shuju
      inject: ['a','b','c'],
      mounted(){
        console.log(this);
      }
    }
    Vue.component('Home', {
      template: `
        <div>
          <h2 >我是home</h2>  
        
          <hr/>
          <common-title></common-title>
        </div>
      `,
      // 向外提供数据 子组件可以使用
      provide: {
        a: 10,
        b: 20,
        c: 30
      },
      components: {
        CommonTitle
      }
    })
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>